#include "stdafx.h"
#include "Parameters.h"
#include <iostream>
#include <fstream>

Parameters::Parameters(void)
:_windowWidth(800), _windowHeight(800), _useAmbient(false),
_subdivisionLevel(2), _itemBufferResolution(512), _meshFilename(""),
_displayFullscreen(false), _displayVisualization(false),
_requestedFPS(20), _shootLevel(2), _fovAngle(45), _fovDecayInterval(2),
_dualView(false)
{
	for(int i = 0; i < 2; i++)
	{
		_cameraPosition[i] = Vector3d(0, 0, -100);
		_cameraAim[i] = Vector3d(0, 0, 0);
		_cameraUp[i] = Vector3d(0, 1, 0);
	}
	SetRadiosityAlgorithm(ProgressiveRefinement);
}

const int Parameters::GetWindowWidth(void) const
{
	return _windowWidth;
}

const int Parameters::GetWindowHeight(void) const
{
	return _windowHeight;
}

const int Parameters::GetRadiosityAlgorithm(void) const
{
	return _algorithm;
}

const std::string Parameters::GetMeshFilename(void) const
{
	return _meshFilename;
}

const int Parameters::GetSubdivisionLevel(void) const
{
	return _subdivisionLevel;
}

const int Parameters::GetItemBufferResolution(void) const
{
	return _itemBufferResolution;
}

const int Parameters::GetTexturesPerFace(void) const
{
	if(_algorithm != ProgressiveRefinement)
	{
		return 5;
	}

	return 2;
}

const bool Parameters::GetDisplayAmbient(void) const
{
	return _useAmbient;
}

const bool Parameters::GetDisplayFullscreen(void) const
{
	return _displayFullscreen;
}

const bool Parameters::GetDisplayVisualization(void) const	
{
	return _displayVisualization;
}

const int Parameters::GetRequestedFPS(void) const
{
	return _requestedFPS;
}

const int Parameters::GetShootLevel(void) const
{
	return _shootLevel;
}

const int Parameters::GetFovAngle(void) const
{
	return _fovAngle;
}

const int Parameters::GetFovDecayInterval(void) const
{
	return _fovDecayInterval;
}

const int Parameters::GetUnshotMipmapShootLevel(void) const
{
	return _unshotMipmapShootLevel;
}

const int Parameters::GetRadiosityDrawBuffersPerFace(void) const
{
	return 2;
}

const int Parameters::GetImportanceDrawBuffersPerFace(void) const
{
	return 3;
}

const Vector3d Parameters::GetCameraPosition(const int camera) const
{
	return _cameraPosition[camera];
}

const Vector3d Parameters::GetCameraAim(const int camera) const
{
	return _cameraAim[camera];
}

const Vector3d Parameters::GetCameraUp(const int camera) const
{
	return _cameraUp[camera];
}

const bool Parameters::GetDualView(void) const
{
	return _dualView;
}

void Parameters::SetWindowWidth(const int width)										
{
	_windowWidth = width;
}

void Parameters::SetWindowHeight(const int height)									
{
	_windowHeight = height;
}

void Parameters::SetRadiosityAlgorithm(const RadiosityAlgorithm algorithm)
{
	_algorithm = algorithm;
}

void Parameters::SetMeshFilename(const std::string filename)						
{
	_meshFilename = filename;
}

void Parameters::SetSubdivisionLevel(const int level)								
{
	_subdivisionLevel = level;
}

void Parameters::SetItemBufferResolution(const int resolution)						
{
	_itemBufferResolution = resolution;
}

void Parameters::SetDisplayAmbient(const bool ambient)									
{
	_useAmbient = ambient;
}

void Parameters::SetDisplayFullscreen(const bool fullscreen)								
{
	_displayFullscreen = fullscreen;
}

void Parameters::SetDisplayVisualization(const bool visualization)								
{
	_displayVisualization = visualization;
}

void Parameters::SetRequestedFPS(const int fps)
{
	_requestedFPS = fps;
}

void Parameters::SetShootLevel(const int shootLevel)
{
	_shootLevel = shootLevel;
}

void Parameters::SetFovAngle(const int fovAngle)
{
	_fovAngle = fovAngle;
}

void Parameters::SetFovDecayInterval(const int fovInterval)
{
	_fovDecayInterval = fovInterval;
}

void Parameters::SetUnshotMipmapShootLevel(const int level)
{
	_unshotMipmapShootLevel = level;
}

void Parameters::SetCameraPosition(const int camera, const Vector3d position)
{
	_cameraPosition[camera] = position;
}

void Parameters::SetCameraAim(const int camera, const Vector3d aim)
{
	_cameraAim[camera] = aim;
}

void Parameters::SetCameraUp(const int camera, const Vector3d up) 
{
	_cameraUp[camera] = up;
}

void Parameters::SetDualView(const bool dualView)
{
	_dualView = dualView;
}
